﻿Imports Infragistics.Win

Public Class Form21
    'Dim udd As IUltraDropDown
    Dim adapter As Object
    Dim binding As BindingSource
    Dim dt As DataTable
    Dim utg As IUltraGrid

    Public Sub New(ByVal udd As IUltraDropDown, ByVal utg As IUltraGrid, ByVal bd As BindingSource, ByVal dt As DataTable, ByVal adapter As Object)
        ' This call is required by the designer.
        InitializeComponent()
        Me.adapter = adapter
        Me.dt = dt
        Me.binding = bd
        'Me.IUltraGrid1.DataSource = bd
        'Me.udd.DataSource = bd
        'Me.udd = udd
        udd.DataSource = bd
        Me.utg = utg
        'Me.IUltraGrid1.DisplayLayout.CopyFrom(utg.DisplayLayout)
        Me.IUltraGrid1.DataSource = bd
        Me.IUltraGrid1.DisplayLayout.Bands(0).Columns(0).ValueList = udd
        ' Add any initialization after the InitializeComponent() call.
        'Me.IUltraGrid1.setGiaoDienVua()
    End Sub

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        'Me.binding.EndEdit()
        'Me.adapter.update(Me.dt)
        'For index = 0 To Me.IUltraGrid1.DisplayLayout.Bands(0).Columns.Count - 1
        '    MessageBox.Show(Me.IUltraGrid1.DisplayLayout.Bands(0).Columns(index).Key.ToString)
        'Next
        'Dim pr As PresetSerializer = PresetSerializer.FromObject(utg, PresetType.All)
        'pr.Apply(Me.IUltraGrid1)
        'Me.IUltraGrid1.DisplayLayout.Bands(0).CardView = True
        ''Me.IUltraGrid1.setGiaoDien_Doi_ThongTin()
        'Me.IUltraGrid1.DisplayLayout.Bands(0).CardSettings.AutoFit = True
        'Me.IUltraGrid1.DisplayLayout.Bands(0).CardSettings.MaxCardAreaCols = 1
        'Me.IUltraGrid1.DisplayLayout.LoadFromXml(Computer.FileSystem.Drives.
        Dim FileLayout As New IO.FileStream("C:\test1.xml", IO.FileMode.OpenOrCreate)
        FileLayout.Seek(0, IO.SeekOrigin.Begin)
        utg.DisplayLayout.Save(FileLayout, Infragistics.Win.UltraWinGrid.PropertyCategories.All)
        FileLayout.Close()

    End Sub

    Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
        Dim FileLayout As New IO.FileStream("C:\test1.xml", IO.FileMode.Open)

        FileLayout.Seek(0, IO.SeekOrigin.Begin)

        Me.IUltraGrid1.DisplayLayout.Load(FileLayout)

        FileLayout.Close()
    End Sub
End Class